<?php
/*
 * @Descripttion: 
 * @version: 1.0
 * @Author: Sam
 * @Date: 2022-04-21 15:27:13
 * @LastEditors: Sam
 * @LastEditTime: 2022-11-15 11:44:32
 */
use app\admin\model\AuthRule as AuthRuleModel;
if (!AuthRuleModel::where('title', '积分商城')->count()) {

    $parent_id = AuthRuleModel::query()->create([
        'parent_id'    => 0,
        'title'        => '积分商城',
        'url'          => '#',
        'method'       => 'OPTIONS',
        'slug'         => 'score'
    ]);
   $parent_id_1 =   AuthRuleModel::query()->create([
        'parent_id'    => $parent_id->id,
        'title'        => '商品列表',
        'url'          => 'score_index',
        'method'       => 'GET',
        'slug'         => 'score.index'
    ]);
    $parent_id_2 =   AuthRuleModel::query()->create([
        'parent_id'    => $parent_id->id,
        'title'        => '兑换记录',
        'url'          => 'exchange_log',
        'method'       => 'GET',
        'slug'         => 'score.exchange_log'
    ]);
   AuthRuleModel::query()->create([
        'parent_id'    => $parent_id_2->id,
        'title'        => '中奖记录导出',
        'url'          => 'exchange_log_export',
        'method'       => 'POST',
        'slug'         => 'score.exchange_log_export'
    ]);
  AuthRuleModel::query()->create([
        'parent_id'    => $parent_id_2->id,
        'title'        => '发货',
        'url'          => '/score_deliver',
        'method'       => 'POST',
        'slug'         => 'score.deliver'
    ]);
    AuthRuleModel::query()->create([
        'parent_id'    => $parent_id_2->id,
        'title'        => '审核通过',
        'url'          => 'score',
        'method'       => 'POST',
        'slug'         => 'score.verify'
    ]);
    AuthRuleModel::query()->create([
        'parent_id'    => $parent_id_2->id,
        'title'        => '审核拒绝',
        'url'          => 'score',
        'method'       => 'POST',
        'slug'         => 'score.refund'
    ]);
    AuthRuleModel::query()->create([
        'parent_id'    => $parent_id_1->id,
        'title'        => '添加',
        'url'          => 'score_create',
        'method'       => 'POST',
        'slug'         => 'score.create'
    ]);
    AuthRuleModel::query()->create([
        'parent_id'    => $parent_id_1->id,
        'title'        => '编辑',
        'url'          => 'score_edit',
        'method'       => 'POST',
        'slug'         => 'score.edit'
    ]);
    AuthRuleModel::query()->create([
        'parent_id'    => $parent_id_1->id,
        'title'        => '删除',
        'url'          => 'score_delete',
        'method'       => 'POST',
        'slug'         => 'score.delete'
    ]);
}



